Skip to content

fix: reject lossy metering usage values - #1630

Open
kang-heewon wants to merge 2 commits into
trunkfrom
fix/1577-integer-usage-values
Open

fix: reject lossy metering usage values#1630
kang-heewon wants to merge 2 commits into
trunkfrom
fix/1577-integer-usage-values

Conversation

@kang-heewon

@kang-heewon kang-heewon commented Jul 30, 2026

Copy link
Copy Markdown
Member

Outcome

Metering now accepts only integer usage values from 1 through 2,147,483,647, matching every supported storage adapter. Fractional, non-finite, non-positive, and oversized values fail with metering/invalid-usage-value before registry lookup, idempotency, or storage.

Redis aggregation, record fetching, and atomic quota checks now reject malformed legacy members instead of truncating them. The TypeScript parser and Lua quota script share the same maximum and fail closed on unsafe aggregate totals.

Verification

  • pnpm --filter @croco/metering-core test — 255 tests passed, 2 opt-in Redis integration tests skipped
  • pnpm --filter @croco/metering-core typecheck
  • pnpm --filter @croco/metering-core lint
  • pnpm --filter @croco/metering-core build
  • pnpm public-api:check
  • pnpm problem-registry:check
  • pnpm docs:api:check
  • pnpm check — 24/25 passed, 1 not applicable
  • pre-push full test/typecheck — 232/232 and 231/231 tasks passed
  • Redis 8.8 Lua smoke — valid totals exact; fractional/oversized legacy members produced no new record or dedupe marker

Review gates

  • Acceptance alignment: pass
  • Adversarial correctness/security: pass after aligning the contract with PostgreSQL INTEGER
  • Maintainability/contracts: pass; shared boundary, generated Problem/API artifacts, and changeset included
  • Independent adversarial review: approved with no high-severity findings

Residual risk

The unit suite mocks EVAL; the actual Lua path was additionally exercised against local Redis 8.8. The repository now also includes opt-in Redis integration coverage for idempotency; malformed-member fail-closed behavior was exercised by the Redis 8.8 smoke above.

Fixes #1577

Summary by CodeRabbit

  • 새로운 기능
    • 사용량 값이 1~2,147,483,647 범위의 양의 정수가 아니면 기록 전에 InvalidUsageValueProblem(metering/invalid-usage-value, HTTP 422)로 거부합니다.
  • 버그 수정
    • Redis에 저장된 누적 사용량이 유효하지 않거나 안전하지 않으면 자동 보정 없이 fail-closed로 처리합니다.
    • 할당량 계산에 사용되는 값(할당/기록)이 일치하지 않으면 즉시 차단합니다.
  • 문서
    • 관련 제약, 오류 코드 및 API/복구 가이드를 갱신했습니다.

@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@kang-heewon, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 54 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 61807f4f-ef54-4cae-a1f6-ef0ead223eb1

📥 Commits

Reviewing files that changed from the base of the PR and between 909ddbd and bea6c31.

⛔ Files ignored due to path filters (1)
  • packages/problems-core/src/generated/problem-code-registry.ts is excluded by !**/generated/**
📒 Files selected for processing (21)
  • .changeset/strict-metering-usage-values.md
  • docs/problem-code-registry.json
  • packages/docs/src/content/docs/api/metering-core/src/classes/InvalidUsageValueProblem.md
  • packages/docs/src/content/docs/api/metering-core/src/classes/MeteringService.md
  • packages/docs/src/content/docs/api/metering-core/src/type-aliases/RecordOptions.md
  • packages/docs/src/content/docs/api/metering-core/src/type-aliases/UsageRecord.md
  • packages/docs/src/content/docs/api/problems-core/src/classes/Problem.md
  • packages/docs/src/content/docs/api/problems-core/src/variables/CROCO_PROBLEM_CODE_REGISTRY.md
  • packages/docs/src/content/docs/en/reference/problem-recovery-cookbook.md
  • packages/metering-core/README.md
  • packages/metering-core/src/index.ts
  • packages/metering-core/src/libs/MeteringService.ts
  • packages/metering-core/src/libs/RedisUsageStorage.ts
  • packages/metering-core/src/libs/problems/InvalidUsageValueProblem.ts
  • packages/metering-core/src/libs/types.ts
  • packages/metering-core/src/libs/usageValueLimits.ts
  • packages/metering-core/src/libs/validateUsageValue.ts
  • packages/metering-core/src/tests/MeteringService.spec.ts
  • packages/metering-core/src/tests/RedisUsageStorage.spec.ts
  • packages/metering-core/src/tests/problems/Problems.spec.ts
  • public-api-surface.snapshot.json
📝 Walkthrough

Walkthrough

사용량을 1부터 2,147,483,647까지의 정수로 제한하는 검증을 추가했습니다. 잘못된 입력은 idempotency 및 저장 전에 거부되며, Redis의 무효 값·안전 정수 범위 초과·소수 누적은 fail-closed로 처리됩니다. 새 문제 타입과 문서, 테스트도 추가되었습니다.

Changes

사용량 오류 계약

Layer / File(s) Summary
InvalidUsageValueProblem 계약
packages/metering-core/src/libs/problems/*, packages/metering-core/src/index.ts, packages/metering-core/src/tests/problems/*, public-api-surface.snapshot.json, docs/problem-code-registry.json, packages/docs/...
InvalidUsageValueProblem을 추가하고 metering/invalid-usage-value, HTTP 422, 입력값과 원인 정보를 공개 API 및 문제 문서에 반영했습니다.

입력 경계 검증

Layer / File(s) Summary
MeteringService 사용량 검증
packages/metering-core/src/libs/validateUsageValue.ts, packages/metering-core/src/libs/usageValueLimits.ts, packages/metering-core/src/libs/MeteringService.ts, packages/metering-core/src/libs/types.ts, packages/metering-core/src/tests/MeteringService.spec.ts, packages/docs/...
사용량을 양의 32-bit 정수로 검증하고 idempotency 처리 및 저장 전에 잘못된 값을 거부하도록 변경했습니다.

Redis 누적 및 조회 검증

Layer / File(s) Summary
Redis fail-closed 처리
packages/metering-core/src/libs/RedisUsageStorage.ts, packages/metering-core/src/tests/RedisUsageStorage.spec.ts
Redis 저장·조회·quota 계산에서 stored member, 신규 값, 누적합을 검증하고 소수 절삭과 안전 정수 범위 초과를 오류로 처리합니다.

문서 및 릴리스 메타데이터

Layer / File(s) Summary
사용량 계약과 복구 문서
packages/metering-core/README.md, packages/docs/src/content/docs/en/reference/problem-recovery-cookbook.md, .changeset/*
허용 범위, Redis 무효 데이터 처리, 문제 복구 정보와 changeset을 문서화했습니다.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant MeteringService
  participant RedisUsageStorage
  participant Redis
  Client->>MeteringService: record(value)
  MeteringService->>MeteringService: validateUsageValue(value)
  MeteringService->>RedisUsageStorage: recordUsage(valid value)
  RedisUsageStorage->>Redis: idempotency and usage storage
  Redis-->>RedisUsageStorage: stored usage members
  RedisUsageStorage-->>Client: usage result or Problem error
Loading

Possibly related PRs

  • croco-dev/framework#1156: Redis 사용량 파싱과 quota 경로에서 Problem 기반 오류 처리를 변경한 PR입니다.
  • croco-dev/framework#1555: Redis ZSET member 직렬화·파싱 형식과 RedisUsageStorage 경로를 변경한 PR입니다.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 제목이 메팅 사용 값의 손실성 값 거부라는 핵심 변경을 간결하게 잘 요약합니다.
Linked Issues check ✅ Passed 정수 전용 경계 검증과 Redis/Lua의 fail-closed 처리로 #1577의 무손실 계약과 사전 차단 요구를 충족합니다.
Out of Scope Changes check ✅ Passed 문서, 생성 산출물, 테스트, changeset 변경만 보이며 요구사항과 무관한 변경은 보이지 않습니다.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/1577-integer-usage-values

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@kang-heewon
kang-heewon force-pushed the fix/1577-integer-usage-values branch from 7eea0ef to f642b06 Compare July 30, 2026 11:22
@github-actions

github-actions Bot commented Jul 30, 2026

Copy link
Copy Markdown

📊 Benchmark Results

✅ All benchmarks passed

Benchmark p75 Threshold Baseline vs Baseline Status Notes
CrocoApp constructor 9.4μs 30.0ms 8.2μs +15.4% -
CrocoApp lambdaHandler (10 controllers) 259.5μs 50.0ms 258.4μs +0.4% -
Lambda cold-start simulation 434.4μs 80.0ms 418.1μs +3.9% -
Lambda cold-start with headers 382.6μs 80.0ms 369.7μs +3.5% -
Lambda cold-start with binary body 356.1μs 80.0ms 339.1μs +5.0% -
Lambda cold-start with query params 297.0μs 80.0ms 301.3μs -1.4% -
Lambda cold-start with authorizer context 297.3μs 80.0ms 299.8μs -0.8% -
Lambda cold-start realistic scenario 293.5μs 80.0ms 299.2μs -1.9% -
EventBusConfig.start (10 handlers) 1.8μs 10.0ms 1.4μs +23.7% -
EventPublisher.publishNow single event 2.1μs 2.0ms 1.7μs +22.6% -
DefaultHandlerResolver.resolve × 10 0.1μs 5.0ms 0.1μs +0.0% -
Container.get singleton (cold) 62.5μs 5.0ms 70.3μs -11.0% -
Container.register × 50 components 3.2ms 10.0ms 3.2ms -1.7% -
Container.validate (50 components) 3.6ms 20.0ms 3.4ms +6.4% -
Container.get singleton (warm) 1.7μs 500.0μs 1.6μs +3.0% -
TelemetryRuntime.init (lambda preset) 2.4μs 200.0ms 1.1ms -99.8% -
lambdaPreset config creation 1.4μs 2.0ms 1.4μs +0.7% -

Updated: 2026-07-31T03:42:25.741Z · Commit: 0799a06

@kang-heewon
kang-heewon force-pushed the fix/1577-integer-usage-values branch from f642b06 to 82eb51a Compare July 30, 2026 11:49

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/metering-core/src/libs/RedisUsageStorage.ts (1)

82-101: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Lua 스크립트 내 Number.MAX_SAFE_INTEGER 매직 넘버 중복.

9007199254740991이 동일 Lua 스크립트 문자열 안에서 두 번(누적 중간 합, newUsage) 하드코딩되어 있습니다. 로컬 변수로 한 번만 선언해 재사용하면 값이 어긋날 위험을 줄이고 가독성도 개선됩니다.

♻️ 제안하는 리팩터링
 local usageKey = KEYS[1]
 local dedupeKey = ${dedupeKeyLiteral}
 local quota = tonumber(ARGV[1])
 local value = tonumber(ARGV[2])
 local score = tonumber(ARGV[3])
 local member = ARGV[4]
 local allowOverQuota = ARGV[5] == '1'
 local ttlSeconds = ${RedisUsageStorage.RECORD_IDEMPOTENCY_TTL_SECONDS}
+local maxSafeInteger = 9007199254740991
 local records = redis.call('ZRANGEBYSCORE', usageKey, '-inf', '+inf')
 local currentUsage = 0

 for _, existingMember in ipairs(records) do
   local usageValue = string.match(existingMember, '^[^:]+:([1-9]%d*):') or string.match(existingMember, '^[^:]+:([1-9]%d*)$')
   local numericUsageValue = usageValue and tonumber(usageValue)
   if not numericUsageValue or numericUsageValue > ${MAX_USAGE_VALUE} then
     return redis.error_reply('Invalid stored usage value')
   end
   currentUsage = currentUsage + numericUsageValue
-  if currentUsage > 9007199254740991 then
+  if currentUsage > maxSafeInteger then
     return redis.error_reply('Usage total exceeds the safe integer range')
   end
 end

 if redis.call('EXISTS', dedupeKey) == 1 then
   return { 0, currentUsage }
 end

 local newUsage = currentUsage + value
-if newUsage > 9007199254740991 then
+if newUsage > maxSafeInteger then
   return redis.error_reply('Usage total exceeds the safe integer range')
 end
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/metering-core/src/libs/RedisUsageStorage.ts` around lines 82 - 101,
Define a local Lua variable for the safe integer limit once before the
usage-total checks, then replace both 9007199254740991 literals in the existing
records accumulation and newUsage validation with that variable.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/metering-core/src/libs/types.ts`:
- Around line 36-37: Update the documentation comments for both usage amount
fields around value and the corresponding field near lines 53–54 to explicitly
state the supported inclusive range is 1 through 2,147,483,647, matching
validateUsageValue, rather than describing it only as a positive 32-bit integer.

In `@packages/metering-core/src/libs/validateUsageValue.ts`:
- Around line 1-9: Extract MAX_USAGE_VALUE into a dedicated usage-value limits
module, then import and reuse it in both validateUsageValue and
InvalidUsageValueProblem so the validation boundary and default error reason
cannot diverge. Remove the duplicate local constant and literal while preserving
the existing validation behavior.

In `@packages/metering-core/src/tests/MeteringService.spec.ts`:
- Around line 139-148: Update the asynchronous exception assertions in
MeteringService.spec.ts around service.record calls, including the cases near
the existing assertion and lines 216-224, to use rejects.toThrow for
InvalidUsageValueProblem or its message. Preserve the required error code
validation separately rather than using rejects.toMatchObject for the rejection.

---

Outside diff comments:
In `@packages/metering-core/src/libs/RedisUsageStorage.ts`:
- Around line 82-101: Define a local Lua variable for the safe integer limit
once before the usage-total checks, then replace both 9007199254740991 literals
in the existing records accumulation and newUsage validation with that variable.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 7e648da5-ca75-4531-81a6-546fd8357f9b

📥 Commits

Reviewing files that changed from the base of the PR and between 01e5bb6 and 82eb51a.

⛔ Files ignored due to path filters (1)
  • packages/problems-core/src/generated/problem-code-registry.ts is excluded by !**/generated/**
📒 Files selected for processing (20)
  • .changeset/strict-metering-usage-values.md
  • docs/problem-code-registry.json
  • packages/docs/src/content/docs/api/metering-core/src/classes/InvalidUsageValueProblem.md
  • packages/docs/src/content/docs/api/metering-core/src/classes/MeteringService.md
  • packages/docs/src/content/docs/api/metering-core/src/type-aliases/RecordOptions.md
  • packages/docs/src/content/docs/api/metering-core/src/type-aliases/UsageRecord.md
  • packages/docs/src/content/docs/api/problems-core/src/classes/Problem.md
  • packages/docs/src/content/docs/api/problems-core/src/variables/CROCO_PROBLEM_CODE_REGISTRY.md
  • packages/docs/src/content/docs/en/reference/problem-recovery-cookbook.md
  • packages/metering-core/README.md
  • packages/metering-core/src/index.ts
  • packages/metering-core/src/libs/MeteringService.ts
  • packages/metering-core/src/libs/RedisUsageStorage.ts
  • packages/metering-core/src/libs/problems/InvalidUsageValueProblem.ts
  • packages/metering-core/src/libs/types.ts
  • packages/metering-core/src/libs/validateUsageValue.ts
  • packages/metering-core/src/tests/MeteringService.spec.ts
  • packages/metering-core/src/tests/RedisUsageStorage.spec.ts
  • packages/metering-core/src/tests/problems/Problems.spec.ts
  • public-api-surface.snapshot.json

Comment thread packages/metering-core/src/libs/types.ts Outdated
Comment thread packages/metering-core/src/libs/validateUsageValue.ts
Comment thread packages/metering-core/src/tests/MeteringService.spec.ts Outdated
@kang-heewon
kang-heewon force-pushed the fix/1577-integer-usage-values branch from 82eb51a to 80a0d34 Compare July 30, 2026 12:50
@kang-heewon

Copy link
Copy Markdown
Member Author

Addressed the outside-diff Lua review note in 80a0d34: the script now defines maxSafeInteger once from Number.MAX_SAFE_INTEGER and reuses it for both aggregate checks. The focused metering suite (244 tests), repository gate (24/25; one not applicable), and pre-push full test/typecheck (232/232 and 231/231 tasks) pass.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.changeset/strict-metering-usage-values.md:
- Around line 1-6: Update the changeset entry for `@croco/metering-core` from
patch to minor to reflect the breaking usage-value validation contract; leave
`@croco/problems-core` at patch unless its public API is also changed.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: cbed1318-499e-4020-9b5c-447de410b233

📥 Commits

Reviewing files that changed from the base of the PR and between 82eb51a and 80a0d34.

⛔ Files ignored due to path filters (1)
  • packages/problems-core/src/generated/problem-code-registry.ts is excluded by !**/generated/**
📒 Files selected for processing (21)
  • .changeset/strict-metering-usage-values.md
  • docs/problem-code-registry.json
  • packages/docs/src/content/docs/api/metering-core/src/classes/InvalidUsageValueProblem.md
  • packages/docs/src/content/docs/api/metering-core/src/classes/MeteringService.md
  • packages/docs/src/content/docs/api/metering-core/src/type-aliases/RecordOptions.md
  • packages/docs/src/content/docs/api/metering-core/src/type-aliases/UsageRecord.md
  • packages/docs/src/content/docs/api/problems-core/src/classes/Problem.md
  • packages/docs/src/content/docs/api/problems-core/src/variables/CROCO_PROBLEM_CODE_REGISTRY.md
  • packages/docs/src/content/docs/en/reference/problem-recovery-cookbook.md
  • packages/metering-core/README.md
  • packages/metering-core/src/index.ts
  • packages/metering-core/src/libs/MeteringService.ts
  • packages/metering-core/src/libs/RedisUsageStorage.ts
  • packages/metering-core/src/libs/problems/InvalidUsageValueProblem.ts
  • packages/metering-core/src/libs/types.ts
  • packages/metering-core/src/libs/usageValueLimits.ts
  • packages/metering-core/src/libs/validateUsageValue.ts
  • packages/metering-core/src/tests/MeteringService.spec.ts
  • packages/metering-core/src/tests/RedisUsageStorage.spec.ts
  • packages/metering-core/src/tests/problems/Problems.spec.ts
  • public-api-surface.snapshot.json

Comment thread .changeset/strict-metering-usage-values.md
@kang-heewon
kang-heewon force-pushed the fix/1577-integer-usage-values branch from 80a0d34 to c837b60 Compare July 30, 2026 13:25
@kang-heewon
kang-heewon force-pushed the fix/1577-integer-usage-values branch from c837b60 to 909ddbd Compare July 30, 2026 13:54

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/metering-core/src/libs/MeteringService.ts`:
- Around line 60-61: Update both InvalidUsageValueProblem JSDoc blocks in
packages/metering-core/src/libs/MeteringService.ts at lines 60-61 and 72-73 to
state that value must be an integer from 1 through 2,147,483,647. Regenerate the
TypeDoc output so the corresponding entries at
packages/docs/src/content/docs/api/metering-core/src/classes/MeteringService.md
lines 96-99 and 127-130 reflect the source change; do not edit generated
documentation manually, and validate with pnpm docs:api:check and the full
documentation build.

In `@packages/metering-core/src/tests/RedisUsageStorage.spec.ts`:
- Around line 307-322: Update the invalid-value test around storage.record to
verify that Redis is not touched through the actual mockRedis.eval interaction,
rather than mockRedis.set or mockRedis.zadd. Assert eval is not called after the
rejection so the test genuinely covers the pre-idempotency validation behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: c6bbad0d-ef24-42c9-9b92-880e85257841

📥 Commits

Reviewing files that changed from the base of the PR and between 80a0d34 and 909ddbd.

⛔ Files ignored due to path filters (1)
  • packages/problems-core/src/generated/problem-code-registry.ts is excluded by !**/generated/**
📒 Files selected for processing (21)
  • .changeset/strict-metering-usage-values.md
  • docs/problem-code-registry.json
  • packages/docs/src/content/docs/api/metering-core/src/classes/InvalidUsageValueProblem.md
  • packages/docs/src/content/docs/api/metering-core/src/classes/MeteringService.md
  • packages/docs/src/content/docs/api/metering-core/src/type-aliases/RecordOptions.md
  • packages/docs/src/content/docs/api/metering-core/src/type-aliases/UsageRecord.md
  • packages/docs/src/content/docs/api/problems-core/src/classes/Problem.md
  • packages/docs/src/content/docs/api/problems-core/src/variables/CROCO_PROBLEM_CODE_REGISTRY.md
  • packages/docs/src/content/docs/en/reference/problem-recovery-cookbook.md
  • packages/metering-core/README.md
  • packages/metering-core/src/index.ts
  • packages/metering-core/src/libs/MeteringService.ts
  • packages/metering-core/src/libs/RedisUsageStorage.ts
  • packages/metering-core/src/libs/problems/InvalidUsageValueProblem.ts
  • packages/metering-core/src/libs/types.ts
  • packages/metering-core/src/libs/usageValueLimits.ts
  • packages/metering-core/src/libs/validateUsageValue.ts
  • packages/metering-core/src/tests/MeteringService.spec.ts
  • packages/metering-core/src/tests/RedisUsageStorage.spec.ts
  • packages/metering-core/src/tests/problems/Problems.spec.ts
  • public-api-surface.snapshot.json

Comment thread packages/metering-core/src/libs/MeteringService.ts Outdated
Comment thread packages/metering-core/src/tests/RedisUsageStorage.spec.ts
@kang-heewon
kang-heewon force-pushed the fix/1577-integer-usage-values branch 3 times, most recently from d774d76 to 7e3f18f Compare July 30, 2026 17:48
@kang-heewon

Copy link
Copy Markdown
Member Author

The required validate check is currently blocked by an independently reproduced base-branch CI race, tracked in #1651. Exact trunk SHA 88c6ce10feb24a70183e3d3c4bb4c0edfcf705e6 failed the same combined gate in @croco/cli#test, while its later standalone test gate passed. On this unchanged PR head, retries moved between @croco/cli#test and @croco/rpc-codegen#typecheck, and both pass standalone locally. No CI workaround is being added here because it would be unrelated to #1577.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[metering-core] Fractional usage values are truncated during Redis aggregation

1 participant